package net.cyan.nest.integration;

import net.cyan.nest.*;
import org.slf4j.*;

import java.lang.reflect.Type;

/**
 * 
 * @author camel
 * @date 2009-8-3
 */
public class Slf4JFactory implements BeanFactory
{
    public Slf4JFactory()
    {
    }

    public Object newInstance(Type type, BeanContainer container, String name) throws Exception
    {
        Class<?> ownerType = container.getOwnerType();
        return ownerType == null ? LoggerFactory.getLogger("") : LoggerFactory.getLogger(ownerType);
    }

    public Class<?> getInstanceType(Class<?> c) throws Exception
    {
        return Logger.class;
    }

    public boolean isSingleton()
    {
        return false;
    }
}
